﻿//-----------------------------------------------------------------------
// <copyright file="ListHelpers.cs" company="AFS">
// Copyright (c) AFS. All rights reserved.
//
//    This file is part of Chatbox.
//
//    Chatbox is free software: you can redistribute it and/or modify
//    it under the terms of the GNU Lesser General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    any later version.
//
//    Chatbox is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//    GNU Lesser General Public License for more details.
//
//    You should have received a copy of the GNU Lesser General Public License
//    along with Chatbox. If not, see http://www.gnu.org/copyleft/lesser.html
// </copyright>
//----------------------------------------------------------------------- 

namespace ChatBox.XamlUtility
{
    using System.Collections.Generic;
    using System.Collections.ObjectModel;

    /// <summary>
    /// Helpers on lists
    /// </summary>
    public static class ListHelpers
    {
        /// <summary>
        /// Add a list of items to an ObservableCollection
        /// </summary>
        /// <typeparam name="T">the type of object in the ObservableCollection</typeparam>
        /// <param name="list">The ObservableCollection</param>
        /// <param name="newItems">the new items</param>
        public static void AddList<T>(this ObservableCollection<T> list, IEnumerable<T> newItems)
        {
            foreach (T item in newItems)
            {
                list.Add(item);
            }
        }
    }
}
